<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/WEB-INF/taglibs/common/taglibs.jsp"%>
<head>
<title><spring:message code="admin.faqquestion.title" /></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link rel="stylesheet" href="<c:url value="/css/styles.css"/>" />
<script src="<c:url value="/javascripts/common.js"/>"></script>

</head>

<body><%@include file="../top_menu.jsp"%>

<table width="100%">
	<tr>
		<td><c:import url="/WEB-INF/jsp/admin/faq/faq_menu.jsp" /></td>
	</tr>
	<tr>
		<td>
		<h2><spring:message code="admin.faqquestion.label.managequestions" /></h2>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
	
		<td><spring:message code="admin.faqquestion.label.category" />: <form:select id="selectCategory" path="categoryId">
			<form:option value="0">All</form:option>
			<c:forEach items="${listCategories}" var="cat" varStatus="i">
				<option value="${cat.id}"
					<c:if test="${cat.id == categoryId}" >selected="selected"</c:if>>${cat.name}</option>
			</c:forEach>
		</form:select>&nbsp;&nbsp;
		
		<spring:message code="admin.faqquestion.label.questionref" /> 
		<input id="refNumber"  size="40"/>
		 &nbsp;&nbsp;<input type="submit"
			class='ui-button ui-state-default ui-corner-all' value="<spring:message code="admin.faqquestion.button.filter" />"
			onclick="javascript:window.location='faq_question.htm?refNumber=' + document.getElementById('refNumber').value + '&catId=' + document.getElementById('selectCategory').value + '&view=${viewId}';" />
		&nbsp;&nbsp;<a href="faq_question.htm?refNumber=${refNumber}&view=1&catId=${categoryId}"><b><spring:message code="admin.faqquestion.label.viewrepliedquestions" /></b></a> &nbsp;&nbsp;<a
			href="faq_question.htm?view=2&refNumber=${refNumber}&catId=${categoryId}"><b><spring:message code="admin.faqquestion.label.viewunansweredquestions" /></b></a></td>
	</tr>
</table>

<c:if test="${not empty listQuestions.pageItems}">
	<table class="formTable" width="100%" cellspacing="0">
		<tr class="ui-state-default">
			<c:if test="${listQuestions.pageNumber>1}">
				<td align="left"><a
					href="faq_question.htm?refNumber=${refNumber}&pageNo=${listQuestions.pageNumber-1}&catId=${categoryId}&view=${viewId}&sortColumn=${listQuestions.sortColumn}"
					class="mouseEffect"><span class="ui-icon ui-icon-seek-prev"
					style="float: left;"></span><spring:message code="admin.faqquestion.button.previouspage" /></a></td>
			</c:if>
			<c:if test="${listQuestions.pageNumber<listQuestions.pagesAvailable}">
				<td align="right"><a
					href="faq_question.htm?refNumber=${refNumber}&pageNo=${listQuestions.pageNumber+1}&catId=${categoryId}&view=${viewId}&sortColumn=${listQuestions.sortColumn}"
					class="mouseEffect"><span class="ui-icon ui-icon-seek-next"
					style="float: right;"></span><spring:message code="admin.faqquestion.button.nextpage" /></a></td>
			</c:if>
		</tr>
	</table>
	<table class="formTable" width="100%">
		<tr class="formHeader">
			<td colspan="10"><spring:message code="admin.faqquestion.label.listofquestionsfromuser" /></td>
		</tr>
		<tr class="formSubHeader">
			<th>#</th>
			<th><a	href="faq_question.htm?pageNo=${listQuestions.pageNumber}&sortColumn=email&sortOrder=${listQuestions.sortOrder}"
				class="headerLink" style="cursor: pointer;" title="${listQuestions.sortOrder}"><spring:message code="admin.faqquestion.label.email" /></a></th>
				<th><a	href="faq_question.htm?pageNo=${listQuestions.pageNumber}&sortColumn=question&sortOrder=${listQuestions.sortOrder}"
				class="headerLink" style="cursor: pointer;" title="${listQuestions.sortOrder}"><spring:message code="admin.faqquestion.label.questionref" /></a></th>
			<th><a	href="faq_question.htm?pageNo=${listQuestions.pageNumber}&sortColumn=question&sortOrder=${listQuestions.sortOrder}"
				class="headerLink" style="cursor: pointer;" title="${listQuestions.sortOrder}"><spring:message code="admin.faqquestion.label.question" /></a></th>
			<th><a	href="faq_question.htm?pageNo=${listQuestions.pageNumber}&sortColumn=confidential&sortOrder=${listQuestions.sortOrder}"
				class="headerLink" style="cursor: pointer;" title="${listQuestions.sortOrder}"><spring:message code="admin.faqquestion.label.confidential" /></a></th>
			<th><a	href="faq_question.htm?pageNo=${listQuestions.pageNumber}&sortColumn=order_number&sortOrder=${listQuestions.sortOrder}"
				class="headerLink" style="cursor: pointer;" title="${listQuestions.sortOrder}"><spring:message code="admin.faqquestion.label.order" />#</a></th>
			<th><a	href="faq_question.htm?pageNo=${listQuestions.pageNumber}&sortColumn=category_id&sortOrder=${listQuestions.sortOrder}"
				class="headerLink" style="cursor: pointer;" title="${listQuestions.sortOrder}"><spring:message code="admin.faqquestion.label.category" /></a></th>
			<th><a	href="faq_question.htm?pageNo=${listQuestions.pageNumber}&sortColumn=top_rank&sortOrder=${listQuestions.sortOrder}"
				class="headerLink" style="cursor: pointer;" title="${listQuestions.sortOrder}"><spring:message code="admin.faqquestion.label.rankintop" /></a></th>
			<th><a	href="faq_question.htm?pageNo=${listQuestions.pageNumber}&sortColumn=created&sortOrder=${listQuestions.sortOrder}"
				class="headerLink" style="cursor: pointer;" title="${listQuestions.sortOrder}"><spring:message code="admin.faqquestion.label.created" /></a></th>
			<th align="center" colspan="2"><spring:message code="admin.faqquestion.label.actions" /></th>
		</tr>

		<c:forEach var="question" items="${listQuestions.pageItems}"
			varStatus="i">
			<tr class="tr_record">
				<td>${i.count+
				(listQuestions.recordSize*(listQuestions.pageNumber-1))}</td>
				<td>${question.email}</td>
				<td>${question.refNumber}</td>
				<td><a href="view_question.htm?id=${question.id}"><span title="${question.questionFull}">${question.question}</span></a></td>
				<td>${question.confidentialLabel}</td>
				<td>${question.orderNumber}</td>
				
				<td><span title="${question.category.nameFull}">${question.category.name}</span></td>
				<td>${question.topRank}</td>
				<td>${question.createdDatetime}</td>
				<td><c:if test="${!question.answer}">
					<input type="button"
						class='ui-button ui-state-default ui-corner-all' value="<spring:message code="admin.faqquestion.button.reply" />"
						onclick="javascript:window.location='reply_question.htm?id=${question.id}';" />
				</c:if> <c:if test="${question.answer}">
					<input type="button"
						class='ui-button ui-state-default ui-corner-all'
						value="<spring:message code="admin.faqquestion.button.updateanswer" />"
						onclick="javascript:window.location='update_answer.htm?id=${question.id}';" />
				</c:if></td>
				<td><input type="button"
					class='ui-button ui-state-default ui-corner-all' value="<spring:message code="admin.faqquestion.button.delete" />"
					onclick="deleteQuestion('${question.id}')" /></td>
					<c:if test="${question.answer&&!question.faq_Question}">
					<td>
					<input type="button"
					class='ui-button ui-state-default ui-corner-all' value="<spring:message code="admin.faqquestion.button.createfaq" />"
					onclick="createFaq('${question.id}')" />
					</td></c:if>
			</tr>
		</c:forEach>
	</table>
	<table class="formTable" width="100%" cellspacing="0">
		<tr class="ui-state-default">
			<c:if test="${listQuestions.pageNumber>1}">
				<td align="left"><a
					href="faq_question.htm?refNumber=${refNumber}&pageNo=${listQuestions.pageNumber-1}&catId=${categoryId}&view=${viewId}&sortColumn=${listQuestions.sortColumn}"
					class="mouseEffect"><span class="ui-icon ui-icon-seek-prev"
					style="float: left;"></span><spring:message code="admin.faqquestion.button.previouspage" /></a></td>
			</c:if>
			<c:if test="${listQuestions.pageNumber<listQuestions.pagesAvailable}">
				<td align="right"><a
					href="faq_question.htm?refNumber=${refNumber}&pageNo=${listQuestions.pageNumber+1}&catId=${categoryId}&view=${viewId}&sortColumn=${listQuestions.sortColumn}"
					class="mouseEffect"><span class="ui-icon ui-icon-seek-next"
					style="float: right;"></span><spring:message code="admin.faqquestion.button.nextpage" /></a></td>
			</c:if>
		</tr>
	</table>
</c:if>

<%@include file="/WEB-INF/jsp/include/footer.jsp"%>
<script language="javascript">

		function deleteQuestion(id) {
			if (confirm('Are you sure you want to delete this question?')) {
				var deleteUrl = "delete_question.htm?id=" + id;
				window.location = deleteUrl;
			}
		}	
		function createFaq(id) {
			if (confirm('Are you sure you want to Make this question as Faq Question?')) {
				var deleteUrl = "create_question_faq.htm?id=" + id;
				window.location = deleteUrl;
			}
		}
	</script>
</body>
</html>